﻿using Es.Abp.Domain;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Es.Abp.SqlSugarCore
{
    [DependsOn(typeof(EsAbpDomainModule))]
    public class EsAbpSqlSugarCoreModule:AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            var services = context.Services;

            var client = new SqlSugarScope(new ConnectionConfig()
            {
                ConnectionString = "datasource=demo.db",//连接符字串
                DbType = DbType.Sqlite,//数据库类型
                IsAutoCloseConnection = true //不设成true要手动close
            });


            services.AddSingleton<ISqlSugarClient>(client);
        }
    }
}
